package info.emm.weiyipro.demo.sdk;

import wy.conference.ConferenceClient;
import wy.conference.ConferenceClientConfiguration;

final class ConferenceFactory {

    private static ConferenceClient conferenceClient;

    static ConferenceClient instance() {
        if (conferenceClient == null) {
            HttpUtils.setUpINSECURESSLContext();
            ConferenceClientConfiguration configuration
                    = ConferenceClientConfiguration.builder()
                    .setHostnameVerifier(HttpUtils.hostnameVerifier)
                    .setSSLContext(HttpUtils.sslContext)
                    .build();
            conferenceClient = new ConferenceClient(configuration);
        }
        return conferenceClient;
    }

     static void destory() {
        if (conferenceClient != null) {
            conferenceClient.leave();
            conferenceClient = null;
        }
    }

}
